
#include <BFont>
#include "member_BComboBox.h"

using namespace BWE;

member_BComboBox::member_BComboBox(BComboBox* comboBox)
{
	boss = comboBox;
	align = Align_Left | Align_VCenter;
	space = 3;
	arrowState = State_Normal;
	current = -1;
	iconSize.set(16, 16);
	rowHeight = 23;
	board = new IComboBoard(*this, boss);
	board->setVisible(false);
}
member_BComboBox::~member_BComboBox()
{

}

void member_BComboBox::freshRects()
{
	BRect crect = boss->clientRect();

	BRect iconArea = crect;
	iconArea.setWidth(iconSize.width());
	iconRect = iconArea.align(Align_Center, iconSize);

	textRect = crect;
	textRect.left() = iconArea.right() + space;
	textRect.right() = crect.right() - space;

	BRect arrowArea = boss->rect(Part_Right);
	arrowRect = arrowArea.align(Align_Center, iconSize);

	int x = arrowRect.x();
	int y = arrowRect.y();
	int w = arrowRect.width();
	int h = arrowRect.height();
	arrowTriangle[0].set(x, y);
	arrowTriangle[1].set(x + w / 2, y + h);
	arrowTriangle[2].set(x + w, y);

}
